from django.db import models

# Create your models here.




#部门管理模型
class Branchtype(models.Model):
	name = models.CharField(max_length=50)
	pid = models.IntegerField()
	path = models.CharField(max_length=50)

#员工管理模型
class Staff(models.Model):
	# 主要信息: 所属分类id, 姓名, 手机号, 密码, 头像,
	branchtypeid = models.ForeignKey('Branchtype',on_delete=models.CASCADE)
	name = models.CharField(max_length=20)
	phone = models.CharField(max_length=11)
	password = models.CharField(max_length=80)
	face = models.CharField(max_length=100,default="/static/myadmin/assets/img/user06.png")
	
	# 次要信息:  居住地址, 性别, 注册时间
	homeaddress = models.CharField(max_length=100,null=True)
	sex = models.CharField(max_length=1,null=True)
	registerdate = models.DateTimeField(auto_now_add=True)

#员工考勤模型
class Attendance(models.Model):
	staffid = models.ForeignKey('Staff',on_delete=models.CASCADE)
	signin = models.DateTimeField(auto_now_add=True)
	signback = models.DateTimeField(auto_now_add=True)

